

import urllib.request

url = 'https://blog.csdn.net/qiushi_1990/article/details/139960609'

headers = {
    'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
}

request = urllib.request.Request(url=url,headers=headers)

# 获取 Handler 对象
getHandler = urllib.request.HTTPHandler()

# 获取 build_opener 对象
getOpener = urllib.request.build_opener(getHandler)

# 调用 open
response = getOpener.open(request)

content = response.read().decode('utf-8')

print(content)

